package application

import (
	"go-ddd/infrastructure/app"
	"go-ddd/infrastructure/repository"
	"go-ddd/ui/dto"
)

type Activity struct{}

var (
	activityRepository repository.Activity
)

func (*Activity) Get(id int) (*dto.Activity, error) {
	activity, notFound := activityRepository.Find(id)
	if notFound {
		return nil, app.Error{Code: app.StatusNotFound}
	}

	return activity.Transform(), nil
}
